package com.frog.service.friend.service.factory;


import com.frog.service.friend.service.friendList.AbstractFriendListStrategy;
import com.frog.service.friend.enums.FriendListTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class FriendListFactory {

    @Autowired
    private final Map<String, AbstractFriendListStrategy> strategyMap = new ConcurrentHashMap<>();

    public AbstractFriendListStrategy getService(FriendListTypeEnum type) {
        String serviceName = FriendListTypeEnum.getServiceName(type);
        return strategyMap.get(serviceName);
    }
}